/********************************************************************************
Name:  OnContact
Copyright © 2012  HFH International
======================================================
======================================================
Purpose:
-------
To map one-to-one relationship between Contact and PIMS_Id
======================================================
======================================================
History 
-------
VERSION  AUTHOR                DATE        DETAIL              
  1.0  - CG DEV TEAM    7/10/2012   INITIAL DEVELOPMENT  
*********************************************************************************/ 
trigger OnContact on Contact (before insert,after insert,before update, after update) {
    
ContactTriggerHandler handler=new ContactTriggerHandler ();
AccountContactRelationshipTriggerHandler handlerRel=new AccountContactRelationshipTriggerHandler ();

   if(trigger.isbefore && Trigger.isInsert){
         handler.OnbeforeContactPimsId(trigger.new);        //To insert pims id...
         handler.OnbeforeContactNameId(trigger.new);        //To insert nameId..
    }
  if(Trigger.isBefore && Trigger.isUpdate)  {
    handler.OnbeforeContactNameId(trigger.new);             //To insert nameId..
  }
 
   if(trigger.isafter && Trigger.isInsert){
         handler.OnAfterContactPimsId(trigger.new);                   //To update pims id..
   }
   if(trigger.isafter && Trigger.isInsert){                    
         handlerRel.OnAfterContactInsertRelationship(trigger.New);        //To insert relationship..
     }
  if(Trigger.isAfter && Trigger.isUpdate)  {
    handlerRel.OnAfterContactUpdateRelationship(trigger.new);            //To update/insert relationship..
  }
 }